package com.godyhm.example.userendport.Protocol;

public class ProtocolHeader {
	private byte headerType;
	private byte version = 1;
	private boolean compressed = false;
	private byte frameType = Protocol.FRAME_TYPE_CONTROL;
	private byte frameSubType = Protocol.FRAME_TYPE_CONTROL_START_SESSION;
	private byte connectionType = Protocol.FRAME_TYPE_CONNECTION_TYPE_TRANSMISSION_START;
	private short messageId = 0;
	private SessionId sessionId;
	private short frameSequence = 0;
	private int dataSize = 0;

	public ProtocolHeader() {
		version = 0;
		compressed = false;
		frameType = Protocol.FRAME_TYPE_CONTROL;
		frameSubType = Protocol.FRAME_TYPE_CONTROL_START_SESSION;
		connectionType = Protocol.FRAME_TYPE_CONNECTION_TYPE_TRANSMISSION_START;
		messageId = 0;
		sessionId = SessionId.INVALID;
		frameSequence = 0;
		dataSize = 0;
	}

	public ProtocolHeader(byte version, boolean compressed, byte frameType,
			byte frameSubType, byte connectionType, short messageId,
			SessionId sessionId, short framesequence, int dataSize) {
		this.setVersion(version);
		this.setCompressed(compressed);
		this.setFrameType(frameType);
		this.setFrameSubType(frameSubType);
		this.setConnectionType(connectionType);
		this.setMessageId(messageId);
		this.setSessionId(sessionId);
		this.setFrameSequence(framesequence);
		this.setDataSize(dataSize);
	}

	public byte getHeaderType() {
		return headerType;
	}

	public void setHeaderType(byte headerType) {
		this.headerType = headerType;
	}

	public byte getVersion() {
		return version;
	}

	public void setVersion(byte version) {
		this.version = version;
	}

	public boolean isCompressed() {
		return compressed;
	}

	public void setCompressed(boolean compressed) {
		this.compressed = compressed;
	}

	public byte getFrameType() {
		return frameType;
	}

	public void setFrameType(byte frameType) {
		this.frameType = frameType;
	}

	// public byte getSessionId() {
	// return sessionID;
	// }

	public SessionId getSessionId() {
		return sessionId;
	}

	public void setSessionId(short sessionID) {
		this.sessionId = new SessionId(sessionID);
	}

	public void setSessionId(SessionId sessionID) {
		this.sessionId = sessionID;
	}

	public int getDataSize() {
		return dataSize;
	}

	public void setDataSize(int dataSize) {
		this.dataSize = dataSize;
	}

	public short getMessageId() {
		return messageId;
	}

	public void setMessageId(short messageID) {
		this.messageId = messageID;
	}

	public byte getFrameSubType() {
		return frameSubType;
	}

	public void setFrameSubType(byte frameSubType) {
		this.frameSubType = frameSubType;
	}

	public byte getConnectionType() {
		return connectionType;
	}

	public void setConnectionType(byte connectionType) {
		this.connectionType = connectionType;
	}

	public short getFrameSequence() {
		return frameSequence;
	}

	public void setFrameSequence(short frameSequence) {
		this.frameSequence = frameSequence;
	}

};